<template>
  <div @click="add">{{count}} * 2 = {{double}}</div>
  <button @click="asyncAdd">异步增加</button>
</template>

<script setup>
  import { computed } from 'vue'
  import { useStore } from 'vuex'
  // import { useStore } from '../../store/gvuex'

  const store = useStore()

  const count = computed(()=> store.state.count)
  const double = computed(() => store.getters.double)

  function add() {
    store.commit('add')
  }

  function asyncAdd() {
    store.dispatch('asyncAdd')
  }
</script>

<style scoped>

</style>
